#ifndef QRESOURCEMANAGER_H
#define QRESOURCEMANAGER_H

#include "sharedlibglobal.h"

#include <QObject>
#include <QList>
#include <QMap>

namespace SHAREDLIB
{
    class QResourceFile;

    class SHAREDLIB_EXPORT QResourceManager : public QObject
    {
        Q_OBJECT
    public:
        explicit QResourceManager(QObject *parent = 0);

        void    save(const QString &path);
        void    save(const QString &path,const QString &firstName);
        void    load(const QString &path);
        void    clear();

        void    addResource(const QString &firstName,const QString &lastName,const QByteArray &data);
        void    removeResource(const QString &firstName,const QString &lastName="");

        QByteArray resourceData(const QString &firstName,const QString &lastName);


        QStringList resourceFirstNames();
        QStringList resourceLastNames(const QString& firstName);
        QStringList resourceLastNames(int index);
    signals:
        void    resourceAdd(const QString &firstName,const QString &lastName);
        void    resourceRemove(const QString &firstName,const QString &lastName);
    public slots:

    protected:
        QList<QResourceFile*>   m_files;
        QMap<QString,QResourceFile*>    m_nameToFile;
    };

}

#endif // QRESOURCEMANAGER_H
